/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.springapplication.adapters.impl;

import cz.muni.fi.pa165.springapplication.dto.CustomerDTO;
import cz.muni.fi.pa165.springapplication.entities.Customer;

/**
 *
 * @author Daniel Sák, 374560
 */
public class AdaptersHelper {
    /**
     * Transfers entity to DTO object
     * 
     * @param customerEntity
     * @return 
     */
    public static CustomerDTO customerEntityToDTO(Customer customerEntity){
        CustomerDTO customerDTO = new CustomerDTO();
        
        customerDTO.setId(customerEntity.getId());
        customerDTO.setFirstName(customerEntity.getFirstName());
        customerDTO.setSurName(customerEntity.getSurName());
        customerDTO.setNumberOfIdCard(customerEntity.getNumberOfIdCard());
        
        return customerDTO;
    }
    
    /**
     * 
     * @param customerDTO
     * @return 
     */
    public static Customer customerDTOToEntity(CustomerDTO customerDTO){
        Customer customerEntity = new Customer();
        
        customerEntity.setId(customerDTO.getId());
        customerEntity.setFirstName(customerDTO.getFirstName());
        customerEntity.setSurName(customerDTO.getSurName());
        customerEntity.setNumberOfIdCard(customerDTO.getNumberOfIdCard());
        
        return customerEntity;
    }
}
